import Vue from 'vue';
import Router from 'vue-router';
import { resolve } from 'path';
import { request } from 'https';

Vue.use(Router);

export default new Router({
    routes: [
        {
            path: '/',
            redirect: '/login'
        },
        {
            path: '/readme',
            meta: {
                auth_name: 'analysis-list'
            },
            component: resolve => require(['../components/common/Home.vue'], resolve),
            children:[
                {
                    path: '/nullpage',
                    component: resolve => require(['../components/common/NullPage.vue'], resolve)  // 空白页，没有图表权限进入此
                },
                {
                    path: '/',
                    meta: {
                        // auth_name: 'analysis-list',
                    },
                    component: resolve => require(['../components/data/realtime.vue'], resolve)
                },
                {
                    path: '/banner',
                    meta: {
                        auth_name: 'banner-list'
                    },
                    component: resolve => require(['../components/page/Banner/Banner.vue'], resolve),  // 轮播图列表
                },
                {
                    path: '/banner/edit/:id',
                    meta: {
                        auth_name: 'banner-edit'
                    },
                    component: resolve => require(['../components/page/Banner/Form.vue'], resolve) // 编辑
                },
                {
                    path: '/dynamic',
                    meta: {
                        auth_name: 'dynamic-list',
                    },
                    component: resolve => require(['../components/page/Dynamic/Dynamic.vue'], resolve) // 动态列表
                },
                {
                    path: '/dynamic/edit/:id',
                    meta: {
                        auth_name: 'dynamic-edit'
                    },
                    component: resolve => require(['../components/page/Dynamic/Form.vue'], resolve) // 动态编辑
                },
                {
                    path: '/help',
                    meta: {
                        auth_name: 'help-list'
                    },
                    component: resolve => require(['../components/page/Help/Help.vue'], resolve)  // 帮助中心列表
                },
                {
                    path: '/help/edit/:id',
                    meta: {
                        auth_name: 'help-edit'
                    },
                    component: resolve => require(['../components/page/Help/Form.vue'], resolve)  // 帮助编辑
                },
                {
                    path: '/service',
                    meta: {
                        auth_name: 'service-list'
                    },
                    component: resolve => require(['../components/page/Service/Service.vue'], resolve)  // 服务列表
                },
                {
                    path: '/service/edit/:id',
                    meta: {
                        auth_name: 'service-edit'
                    },
                    component: resolve => require(['../components/page/Service/Form.vue'], resolve) // 服务编辑
                },
                {
                    path: '/coupon',
                    meta: {
                        auth_name: 'coupon-list'
                    },
                    component: resolve => require(['../components/page/Coupon/Coupon.vue'], resolve)  // 优惠券列表
                },
                {
                    path: '/coupon/edit/:id',
                    meta: {
                        auth_name: 'coupon-edit'
                    },
                    component: resolve => require(['../components/page/Coupon/Form.vue'], resolve)  // 优惠券编辑
                },
                {
                    path: '/redeemCode',
                    meta: {
                        // auth_name: 'cdkey-list'
                    },
                    component: resolve => require(['../components/page/Cdkey/RedeemCode.vue'], resolve)  // 兑换码列表
                },
                {
                    path: '/redeemCode/:id',
                    component: resolve => require(['../components/page/Cdkey/RedeemCode.vue'], resolve)  // 兑换码
                },
                {
                    path: '/redeemRecord',
                    component: resolve => require(['../components/page/Cdkey/RedeemRecord.vue'], resolve)  // 兑换记录列表
                },
                {
                    path: '/redeemRecord/add',
                    component: resolve => require(['../components/page/Cdkey/Form.vue'], resolve)  // 兑换码创建
                },
                {
                    path: '/school',
                    meta: {
                        auth_name: 'school-list'
                    },
                    component: resolve => require(['../components/page/School/School.vue'], resolve)  // 学校列表
                },
                {
                    path: '/school/detail/:id',
                    meta: {
                        auth_name: 'school-list'
                    },
                    component: resolve => require(['../components/page/School/Detail.vue'], resolve)  // 学校详情
                },
                {
                    path: '/school/edit/:id',
                    meta: {
                        auth_name: 'school-edit'
                    },
                    component: resolve => require(['../components/page/School/Form.vue'], resolve)  // 学校编辑
                },
                {
                    path: '/student',
                    meta: {
                        auth_name: 'student-list'
                    },
                    component: resolve => require(['../components/page/Student/Student.vue'], resolve)  // 学生列表
                },
                {
                    path: '/num',
                    meta: {
                        auth_name: 'num-list'
                    },
                    component: resolve => require(['../components/page/Num/Num.vue'], resolve)  // 号码牌列表
                },
                {
                    path: '/num/edit/:id',
                    meta: {
                        auth_name: 'num-edit'
                    },
                    component: resolve => require(['../components/page/Num/Form.vue'], resolve)  // 号码牌编辑
                }
                ,
                {
                    path: '/fans',
                    meta: {
                        auth_name: 'fans-list'
                    },
                    component: resolve => require(['../components/page/Fans/Fans.vue'], resolve)  // 用户列表
                },
                {
                    path: '/config',
                    meta: {
                        auth_name: 'config-list'
                    },
                    component: resolve => require(['../components/page/Config/Config.vue'], resolve)  // 配置列表
                },
                {
                    path: '/config/edit/:id',
                    meta: {
                        auth_name: 'config-edit'
                    },
                    component: resolve => require(['../components/page/Config/Form.vue'], resolve)  // 配置编辑
                },
                {
                    path: '/order',
                    meta: {
                        auth_name: 'order-list'
                    },
                    component: resolve => require(['../components/page/Order/Order.vue'], resolve)  // 订单列表
                },
                {
                    path: '/refund',
                    meta: {
                        auth_name: 'refund-list'
                    },
                    component: resolve => require(['../components/page/Refund/Refund.vue'], resolve)  // 退款列表
                },
                {
                    path: '/permission',
                    meta: {
                        auth_name: 'perms-list'
                    },
                    component: resolve => require(['../components/page/Permission/Permission.vue'], resolve)  // 权限列表
                },
                {
                    path: '/permission/edit/:id',
                    meta: {
                        auth_name: 'perms-edit'
                    },
                    component: resolve => require(['../components/page/Permission/Form.vue'], resolve)  // 权限编辑
                },
                {
                    path: '/role',
                    meta: {
                        auth_name: 'role-list'
                    },
                    component: resolve => require(['../components/page/Role/Role.vue'], resolve)  // 角色列表
                },
                {
                    path: '/role/edit/:id',
                    meta: {
                        auth_name: 'role-edit'
                    },
                    component: resolve => require(['../components/page/Role/Form.vue'], resolve)  // 角色编辑
                },
                {
                    path: '/role/attach',
                    meta: {
                        auth_name: 'role-edit'
                    },
                    component: resolve => require(['../components/page/Role/Attach.vue'], resolve)  // 权限分配
                },
                {
                    path: '/role/sync',
                    meta: {
                        auth_name: 'role-edit'
                    },
                    component: resolve => require(['../components/page/Role/Sync.vue'], resolve)  // 角色分配
                },
                {
                    path: '/user',
                    meta: {
                        auth_name: 'user-list'
                    },
                    component: resolve => require(['../components/page/User/User.vue'], resolve)  // 管理员列表
                },
                {
                    path: '/user/edit/:id',
                    meta: {
                        auth_name: 'user-edit'
                    },
                    component: resolve => require(['../components/page/User/Register.vue'], resolve)  // 管理员密码重写
                },
                {
                    path: '/key',
                    meta: {
                        auth_name: 'key-list'
                    },
                    component: resolve => require(['../components/page/WX/Key.vue'], resolve)  // 关键字列表
                },
                {
                    path: '/key/edit/:id',
                    meta: {
                        auth_name: 'key-edit'
                    },
                    component: resolve => require(['../components/page/WX/Form.vue'], resolve)  // 关键字编辑
                },
                {
                    path: '/wx/send',
                    meta: {
                        auth_name: 'school-edit'
                    },
                    component: resolve => require(['../components/page/WX/Send.vue'], resolve)  //  微信信息发送
                },
                {
                    path: '/add',
                    component: resolve => require(['../components/common/AddOrEdit.vue'], resolve) // 添加编辑
                },
                {
                    path: '/realtime',
                    meta: {
                        auth_name: 'analysis-list'
                    },
                    component: resolve => require(['../components/data/realtime.vue'], resolve)  // 用户实时数据展示
                },
                {
                    path: '/lexisummary',
                    meta: {
                        auth_name: 'analysis-list'
                    },
                    component: resolve => require(['../components/data/lexi/summary.vue'], resolve)  // 乐洗用户统计
                },
                {
                    path: '/schoolsummary',
                    meta: {
                        auth_name: 'analysis-list'
                    },
                    component: resolve => require(['../components/data/school/summary.vue'], resolve)  // 学校用户统计
                },
                {
                    path: '/wxdata',
                    meta: {
                        auth_name: 'analysis-list'
                    },
                    component: resolve => require(['../components/data/wx/wxdata.vue'],  resolve)  // 微信用户数据显示
                }
            ]
        },
        {
            path: '/login',
            component: resolve => require(['../components/page/Login.vue'], resolve)
        }
    ]
})
